package com.itheima.service.impl;

import com.itheima.entity.ClazzSizeOption;
import com.itheima.mapper.ReportMapper;
import com.itheima.mapper.StudentMapper;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Description ReportServiceImpl
 * @Author 你的名字拼接或昵称
 * @Date 2025-09-07
 */
@Slf4j
@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private ReportMapper reportMapper;
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Map<String, Object>> getstudegree() {

        return reportMapper.getstudegree();
    }

    @Override
    public ClazzSizeOption getClazzData() {
        List<Map<String,Object>> list =studentMapper.studentCount();
        List<Object> clazz = list.stream().map(dateMap -> dateMap.get("clazz")).toList();
        List<Object> numList = list.stream().map(dateMap -> dateMap.get("num")).toList();
        return new ClazzSizeOption(clazz,numList);
    }


}
